#
# Makefile for the FREAX-kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#

AR	=gar
AS	=as --32
LD	=gcc -m32
LDFLAGS	=-s -x
CC	=gcc -m32
CFLAGS	=-w -O -fstrength-reduce -fomit-frame-pointer \
	-finline-functions -fno-stack-protector

.c.s:
	$(CC) $(CFLAGS) \
	-S -o $*.s $<
.s.o:
	$(AS) -c -o $*.o $<
.c.o:
	$(CC) $(CFLAGS) \
	-c -o $*.o $<

LIBS  = buffer.o inode.o panic.o printk.o hd.o \
	block_dev.o super.o namei.o bitmap.o open.o \
	read_write.o file_dev.o
all: 	$(LIBS) m2.o
	$(LD) -o m2 m2.o $(LIBS)

clean:
	rm -f core *.o *.a tmp_make
	for i in *.c;do rm -f `basename $$i .c`.s;done

dep:
	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
	(for i in *.c;do echo -n `echo $$i | sed 's,\.c,\.s,'`" "; \
		$(CPP) -M $$i;done) >> tmp_make
	cp tmp_make Makefile

### Dependencies:
block_dev.s block_dev.o: block_dev.c buffer.h
buffer.s buffer.o: buffer.c buffer.h
inode.s inode.o: inode.c buffer.h
m1.s m1.o: m1.c
panic.s panic.o: panic.c
printk.s printk.o: printk.c
